import request from '@/utils/request'
import { type Result } from '@/types/result'
import { type UserAddress } from '@/types/user'

// 根据用户ID查询所有地址
export function getUserAddressesApi(): Promise<Result> {
  return request.get('/address')
}

// 新增用户地址
export function createAddressApi(userAddress: UserAddress): Promise<Result> {
  return request.post('/address', userAddress)
}

// 修改用户地址
export function updateAddressApi(userAddress: UserAddress): Promise<Result> {
  return request.put('/address', userAddress)
}

// 根据地址ID查询地址
export function getAddressApi(id: string): Promise<Result> {
  return request.get(`/address/${id}`)
}

// 删除用户地址
export function deleteAddressApi(id: string): Promise<Result> {
  return request.delete(`/address/${id}`)
}

